/**
 * 
 */
package com.dalonedrau.jogl.engine;

/**
 * An {@link Action} that fires after a delay.
 * @author Donald
 */
public abstract class DelayedAction implements Action {
	/** the {@link Timer} associated with this {@link Action}. */
	private Timer	timer;
	/**
	 * Creates a new instance of DelayedAction.java.
	 * @param delay the time in nanoseconds to delay the {@link Action}
	 */
	public DelayedAction(final long delay) {
		timer = new Timer();
		timer.setDuration(delay);
	}
	/** Resets the {@link DelayedAction}'s {@link Timer}. */
	public final void reset() {
		timer.reset();
	}
	/**
	 * Determines if the {@link DelayedAction}'s delay period is over.
	 * @param time the current time
	 * @return true if the current time is equal to or after the
	 *         {@link DelayedAction}'s delay; false otherwise
	 */
	public final boolean timesUp(final long time) {
		return timer.stopwatch(time);
	}
}
